home *** CD-ROM | disk | FTP | other *** search
- /*
- DarkSide 3.0 - a 7.0 dependant, system clean expandable screen saver.
-
- copyright © 1990, 1991, 1992 by Tom Dowdy
- All rights reserved.
-
- This is a simple fader that shows how to create a fader for DarkSide.
- */
- #include <Memory.h>
- #include <Windows.h>
- #include <Dialogs.h>
- #include <Errors.h>
-
- #include "Fader.h"
-
- /* ------------------------------------------------------------------------ */
- /* GLOBAL VARIABLES */
- /* ------------------------------------------------------------------------ */
- long gNextInvert; // next time to invert the screens
-
- /* ------------------------------------------------------------------------ */
- OSErr PreflightFader(MachineInfoPtr machineInfo, long *minTicks, long *maxTicks)
- /*
- Called when fader is starting up - before window has been created
- */
- {
- #pragma unused (machineInfo)
-
- // no need to go faster than this!
- *minTicks = 1;
- *maxTicks = 15;
-
- return(noErr);
-
- } // PreflightFader
-
- /* ------------------------------------------------------------------------ */
- OSErr InitializeFader(MachineInfoPtr machineInfo)
- /*
- Called when fader is starting up - after window has been created
- */
- {
- short screenIndex;
- ScreenInfoPtr pScreen;
-
-
- pScreen = &machineInfo->theScreens[0];
- for (screenIndex = 0; screenIndex < machineInfo->numScreens; ++screenIndex)
- {
- PaintRect(&pScreen->bounds);
-
- ++pScreen;
- }
-
- gNextInvert = TickCount();
-
- return(noErr);
-
- } // InitializeFader
-
- /* ------------------------------------------------------------------------ */
- OSErr IdleFader(MachineInfoPtr machineInfo)
- /*
- Called during idle time for the fader
- */
- {
- short screenIndex;
- ScreenInfoPtr pScreen;
-
-
- if (TickCount() > gNextInvert)
- {
- pScreen = &machineInfo->theScreens[0];
- for (screenIndex = 0; screenIndex < machineInfo->numScreens; ++screenIndex)
- {
- if (Random() & 0x01)
- InvertRect(&pScreen->bounds);
-
- ++pScreen;
- }
-
- gNextInvert = TickCount()
- + (9-machineInfo->faderSettings->theShorts[0]) * 10;
- }
-
- return(noErr);
-
- } // IdleFader
-
-
- /* ------------------------------------------------------------------------ */
- OSErr DisposeFader(MachineInfoPtr machineInfo)
- /*
- Called when the fade is tearing down
- */
- {
- #pragma unused (machineInfo)
-
- return(noErr);
-
- } // DisposeFader
-
- /* ------------------------------------------------------------------------ */
- OSErr UpdateFader(MachineInfoPtr machineInfo)
- /*
- Called when there is an update event for our fade window.
- */
- {
- // erase the screen
- InitializeFader(machineInfo);
- return(noErr);
-
- } // UpdateFader
-
- /* ------------------------------------------------------------------------ */
- OSErr HitFader(MachineInfoPtr machineInfo, DialogPtr dPtr, short itemHit, short itemOffset)
- /*
- Called when there is an event in the settings dialog. itemHit will be
- the item the user has selected, or 0 when the dialog is being set up.
-
- itemHit - itemOffset will allow you to determine which item in your dialog
- list this corresponds to.
-
- If you don't wish to do any special processing of this event, simply return
- "fnfErr" and the standard effect will take place.
-
- WARNING: Your A5 world may not be set up at this point, so don't try to use
- your global variables!!!
- */
- {
- #pragma unused (machineInfo, dPtr, itemHit, itemOffset)
-
- return(fnfErr);
-
- } // HitFader
-